1. Field of the Invention
The present invention relates to a method of controlling a signal generator that uses a microcomputer having a timer and turns on/off a semiconductor device by means of the timer.
2. Related Background Art
There have hitherto been known various signal generators for switching semiconductor devices.
Particularly, microcomputers having timers are capable of switching semiconductor devices at higher frequency than the operating frequencies of the microcomputers because the timers operate in parallel with the programs of the microcomputers and signals are outputted from I/O ports.
Such microcomputers having timers are used to control various semiconductor switches. Typically, such a microcomputer controls the semiconductor main SW circuit of a power converter or a semiconductor circuit in a motor drive for a camera or a VTR.
As a representative example of controlling the turning on/off of a semiconductor device by means of the microcomputer, the following will describe a power converter for photovoltaic power generation and a method of controlling the same.
FIG. 2 is a block circuit diagram showing the power converter for photovoltaic power generation. Direct-current power from a solar battery connected to an input terminal is converted to alternating current power by a DC/AC converter circuit which is constituted of a push-pull section 241, an inverting section 242 and so on, and the converted power is outputted from an output terminal. In the push-pull section, two switching elements are subjected to PWM control, direct-current power is subjected to DC/AC conversion, and a voltage is increased by a transformer. Thereafter, passage is made through a diode bridge and an inductance, so that a sinusoidal waveform is generated with full-wave rectification.
The following will describe a method of generating a driving signal of a switching element in the push-pull section. A reference sinusoidal waveform pattern having been recorded in a ROM beforehand is multiplied by a current command value commanded by MPPT (maximum power point tracking) of the solar battery, so that an instantaneous current command value is generated. Then, the instantaneous current command value generated thus is compared with an instantaneous current detection value, which is generated by converting the output of an output current detector to digital data by means of an AD converter in a microcomputer. Then, a Duty value (a ratio of an ON period to a switching period) for correcting an error is calculated. A timer set value is calculated according to the calculated Duty value and the timer set value is stored in a register for a timer, so that the timing of turning on/off the switching element is controlled. In this case, a control flowchart shown in FIG. 13 is obtained. The following will specifically describe switching control using the microcomputer having the timer that realizes the control flow of FIG. 13.
In the control of the switching element, a single (increment) timer in the microcomputer, four registers in the microcomputer and two I/O ports are used. In the microcomputer used in this control, when the timer counter value of the timer agrees with (compare match) a value set in the register, the output of the I/O terminal becomes High or Low, so that the turning on/off of the switching element is controlled.
For more details, specific numeric values are substituted in the following explanation. For example, it is presumed that a microcomputer having an operating frequency of 20 MHz is used, a switching frequency is 20 kHz, and a Duty set value obtained by operations is 50%.
When the values of timer registers TIMR 1 to 4 and the value of the timer counter agree with one another, the I/O terminals have output states shown in FIG. 3. In such a setting, in order to set the Duty set value at 50%, the timer registers need to be set so that TIMR1=250, TIMR2=500, TIMR3=750 and TIMR4=1000 are obtained. In this case, a relationship between the values of the timer counters and the outputs of the I/O terminals is obtained as FIG. 4. When the value of the timer counter agrees with 250 that is the set value of the TIMR1, a High signal is outputted from an S1 terminal. When the value of the timer counter agrees with 500 that is the set value of TIMR2, a Low signal is outputted from the S1 terminal. When-the value of the timer counter agrees with 750 that is the set value of TIMR3, a High signal is outputted from an S2 terminal. When the value of the timer counter agrees with 1000 which is the set value of TIMR4, a Low signal is outputted from the S2 terminal. A timer counter is reset at 0 at the same time and counting is restarted from 0. Actually the set values of the timer registers are changed repeatedly every time a duty ratio is calculated. Control is performed so that a sinusoidal wave with full-wave rectification is outputted to the input of the inverting section 242 by resetting a duty ratio.
Namely, a period during which the value of the timer counter is counted from 0 to TIMR4 (fixed at 1000 in the present example) is referred to as a switching period. During this period, processing in the PWM setting loop of FIG. 13 is performed. For example, when a switching frequency is 20 kHz, the loop is performed 20000 times per second. In many cases, a switching frequency of a power converter for photovoltaic power generation is set around 20 to 40 kHz in consideration that the maximum frequency of an audio frequency is 16 kHz.
In recent years, a power converter-integrated solar cell module has been developed in which power converters of equal capacities (about 100 W) are mounted on the back of a single solar cell module. The power converters used in the module are integrally mounted on the solar cell module. It is desirable that such power converters be small in size (100 to 300 cc). Hence, a switching operation is performed faster in the power converter and the internal components (high-frequency transformer, coil, capacitor) of the power converter are miniaturized.
Further, as a power converter for similarly outputting a sinusoidal waveform, power converters for driving motors are known in general.
In the power converter for driving a motor, the amplitude of a sinusoidal waveform is stored beforehand in a semiconductor memory as a digital value of about 8 to 16 bits, the value is converted to PWM control signals shown in FIG. 5, and the signals are outputted, so that switching elements (FIG. 6) arranged in a full bridge configuration are controlled and a sinusoidal waveform is outputted.
However, the conventional controlling method causes the following problem: in the power converter for photovoltaic power generation, feedback control using an output current value is performed as shown in FIG. 13 and thus an arithmetic quantity is increased in the microcomputer. At this point in time, since it takes a long time to calculate a duty ratio and set the timer register, a period generating no signal is more likely to appear in some relationships between the set value of the timer register and the count value of the timer count.
The following explanation will be made with specific numeric values. It is assumed that in the step of calculating a duty ratio and the step of setting a timer register value in an interrupting step before a predetermined period, TIMR1=350, TIMR2=500, TIMR3=850, and TIMR4=1000 set for the four time registers as shown in FIG. 7. Currently setting is made so that when the timer counter has a value of 350, the S1 terminal is placed in a High state, when the timer counter has a value of 500, the S1 terminal is placed in a Low state, when the timer counter has a value of 850, the S2 terminal is placed in the High state, when the timer counter has a value of 1000, the S1 terminal is placed in the Low state. It is assumed that when the current output current value is detected and a duty ratio is calculated, timer register values set in the step of setting timer register values are calculated so as to have TIMR1=200, TIMR2=500, TIMR3=700, and TIMR4=1000 as shown in FIG. 7. At this point in time, since it takes a long time to calculate a duty ratio, the timer counter has already exceeded the value of the timer register TIMR1. In this case, the signal of the I/O terminal remains in the Low state. For example, when the calculation of a duty ratio is completed by the timer counter, in the case where the count value is already 250, High output is not made from the S1 terminal. Namely, when 200 serving as the current set value is written at the time of changing the set value of TIMR1, the timer counter already exceeds 200, which is the set value of TIMR1, and thus a High signal is not outputted from the S1 terminal as shown in FIG. 8. The set value of TIMR3 is also changed from 850 to 700 immediately after the set value of TIMR1 is changed. In this case, since the timer counter has not reached the set value of TIMR3, a High signal is normally outputted from the S2 terminal. As a result, since the High signal is not outputted from the S1 terminal, a switching element Q1 is not driven and only one side of the push-pull section is turned on.
Such a signal waveform dropout may generate noise from a transformer connected to the subsequent stage of the switching element or may cause a time period when voltage is applied only to one side of the transformer. Hence, the transformer may have biased magnetization and may not function as a power conditioner. Particularly, since a waveform dropout frequently occurs when a duty ratio increases, biased magnetization arises a serious problem.
In order to solve the problem, a microcomputer with a high computing speed may be used to perform a Duty operation and a Duty setting before a waveform is generated. However, the microcomputer has to have high processing speed.
Since the high-speed microcomputer is expensive with a high power consumption, a power converter has low efficiency, a higher temperature, and a large peripheral circuit. Particularly when power converters are manufactured with small sizes and capacities, disadvantageous conditions are imposed.
Further, a method of limiting the maximum duty ratio so as to secure a calculating/setting time is available. In this method, the ON period of the switching element is shortened and thus a power cannot be fed sufficiently to the output side.
Furthermore, in the power converter having a transformer, an ON time (duty ratio) has to be equal at the switching of Q1 and Q2. If two switching elements are different in ON time, positive and negative voltages applied to the transformer disagree with each other. This state is the same as the application of direct-current voltage to the transformer. The transformer has biased magnetization as in the case of a waveform dropout and may not normally operate as a power conditioner.